package ioc

import (
	consul "github.com/hashicorp/consul/api"
	"github.com/spf13/viper"
)

func InitConsul() *consul.Client {

	addr := viper.GetString("consul.addr")

	cfg := consul.Config{
		Address: addr,
	}

	client, err := consul.NewClient(&cfg)

	if err != nil {
		panic(err)
	}

	return client
}
